<template>
  <div class="top-container">

    <div class="left-box">
      <div class="icon-wrapper">
        <router-link to="/discovery">
          <h1>音乐播放器</h1>
        </router-link>
      
      </div>
    </div>

    <div class="right-box">
      <div class="el-input el-input--small el-input--prefix">
        <!-- 搜索框 -->
        <input
          type="text"
          autocomplete="off"
          placeholder="搜索"
          class="el-input__inner"
          v-model="inputValue"
          @keyup.enter="toSearch"
        />
        <span class="el-input__prefix">
          <i class="el-input__icon el-icon-search"></i>
        </span>
      </div>
    </div>

    <div class="login">
      <router-link to="/login">
        <el-button type="primary" round  >登录</el-button>
      </router-link>
      
    </div>
    
  </div>
  
</template>

<script>
  export default {
    name: 'top',
    data() {
      return {
        inputValue:''
      }
    },
    methods:{
      toSearch(){
        if(this.inputValue==""){
           this.$message({
              message: '请输入搜索内容',
              type: 'warning'
            })
        }else{
          this.$router.push(`/result?q=${this.inputValue}`)
         
        }
      }
    }
  }
</script>

<style scoped>
</style>
